<template>
	<view class="all">
		<view class="shangpin">
			<view class="sp-left">
				<view class="sp-img">
					<image src="../../../static/addition/imgs5.png" mode=""></image>
				</view>
				<view class="sp-name">
					<view class="">{{baoyou}}</view>
					<view class="">{{jiaoyi}}</view>
					<view class="">{{jin}}</view>
				</view>
			</view>
			<view class="sp-right" @click="daiZhifu">
				立即购买
			</view>
		</view>
		<view class="xinxi">
			<view class="xin-xin">
				你好我有几个问题需要咨询下
			</view>
			<view class="xin-ing">
				<image src="../../../static/addition/add-imgs1.png" mode=""></image>
			</view>
		</view>
		<!-- @tap="tapPopup2" -->
		<view class="btn-lt">
			<view class="btn-lt-btn1">
				<view class="btn1-left">
					<input type="text" value="" />
				</view>
				<view class="btn-lt-btn1-right">
					<view class="btn-lt-btn1-right-img1">
						<image src="../../../static/mall/mall15.png" mode=""></image>
					</view>
					<view class="btn-lt-btn1-right-img1">
						<image src="../../../static/mall/mall14.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="btn-lt-btn2">
				<view class="btn-lt-btn2-left"  @click="camera('camera')">
					<image src="../../../static/mall/mall17.png" mode=""></image>
				</view>
				<view class="btn-lt-btn2-left" @click="camera('album')">
					<image src="../../../static/mall/mall16.png" mode=""></image>
				</view>
			</view>
		</view>
		<view class="popup" v-show="show2">
			<view class="popup-info">
				<view class="popup-input"><input type="text" value="" placeholder="请输入留言内容" /></view>
				<view class="popup-btn">
					<button @tap="cancel2" class="prop-btn1" @click="cancel2">取消</button>
					<button @tap="affirm2" class="prop-btn2" @click="affirm2">确认</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				infolist: '', //接收
				imgs1: [],
				jin: '',
				baoyou: '包邮',
				jiaoyi: '交易前聊一聊',
				waresPrice: '0', // 寄售商品价格
				waresId: '',// 寄售商品ID
				walletPrice:'0',// 余额支付金额（未用传0
				actualPrice:'',//实付金额
				address:'山东省济南市先行区王大佬庄183号无名氏街道多娜多娜花园一号楼王大锤18868866622',// 收货地址
				ucId:'',//优惠券ID（无优惠券不
				discount:'0',//优惠券抵扣金额未用传0
				show2: false,
			};
		},
		onLoad(options) {
			console.log(options,'-----------------------------------------------')
			this.waresPrice = options.waresPrice
			console.log(options.waresId,'gogogo');
			this.waresId = options.waresId
			this.infolist = JSON.parse(options.content1)
			console.log(this.infolist, '/////***---')
			console.log(this.infolist[0].nameimg)
			// this.waresPrice = this.infolist[0].waresPrice
			console.log(this.waresPrice,'11111111111111111111')
			this.imgs1 = this.infolist.nameimg
		},
		methods: {
			tapPopup2() {
				this.show2 = true;
			},
			// 点击弹窗取消
			cancel2() {
				this.show2 = false;
			},
			affirm2() {
				this.show2 = false;
			},
			close() {
				this.$refs.popup.close()
			},
			camera(val){
							uni.chooseImage({
								count: 6, //默认9
								sizeType: [ 'compressed'], //original 原图，compressed 压缩图，默认二者都有
								sourceType: [val], //album 从相册选图，camera 使用相机，
								success: (res)=> {
										
									const tempFilePaths = res.tempFilePaths;
									console.log(tempFilePaths[0])
									this.close();
									this.imgList.push(tempFilePaths[0]);
								
											// return false;
											uni.uploadFile({
												url: 'http://licai.youma.me/index/publics', //仅为示例，非真实的接口地址
												filePath: tempFilePaths[0],
												name: 'file',
												success: (uploadFileRes) => {
													var data=JSON.parse(uploadFileRes.data)
														this.fromData.qualification.push(data.Data)
														console.log(data.Data);
												}
											});
											}
										});
									},
									daiZhifu() {
										var content1 = JSON.stringify(this.infolist)
										uni.navigateTo({
											url:'../../commodity-details/indet2?waresId=' + this.waresId + '&waresPrice='+ this.waresPrice + '&content1=' + content1
										})
									}
			//待支付订单
			// daiZhifu() {
			// 	var that = this
			// 	that.$http.req.ajax({
			// 		path: ':8090/web/idleOrders/idleOrderSave',
			// 		header: {
			// 			'token': uni.getStorageSync('token')
			// 		},
			// 		data: {
			// 			waresId: that.waresId, // 寄售商品ID
			// 			waresPrice: that.waresPrice, // 寄售商品价格
			// 			walletPrice: that.walletPrice, // 余额支付金额
			// 			actualPrice: '100', // 实付金额
			// 			address: that.address, // 收货地址
			// 			discount: that.discount //优惠券抵扣金额
			// 		},
			// 		afterAjax: (res) => {
			// 			console.log(res, '待支付订单接口')
			// 			if (res.code !== 200) {
			// 				console.log(res.data, '待支付订单接口错误')
			// 			}
			// 			if (res.code == 200) {
			// 				console.log('待支付订单通了')
			// 				uni.showToast({
			// 					title: '待支付订单接口',
			// 					icon: 'none'
			// 				})
			// 			}
			// 		}
			// 	})
			// },
		}
	}
</script>

<style lang="scss">
	.all {
		.shangpin {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			margin: 0 25.36rpx;

			.sp-left {
				display: flex;
				flex-direction: row;
				justify-content: space-between;

				.sp-img {
					width: 115.94rpx;
					height: 115.94rpx;

					image {
						max-width: 100%;
						max-height: 100%;
					}
				}

				.sp-name {
					display: flex;
					flex-direction: column;
					justify-content: center;
					font-size: 21rpx;
					font-weight: 600;
				}
			}

			.sp-right {
				width: 137.68rpx;
				height: 61.59rpx;
				border-radius: 39.85rpx;
				padding: 14.49rpx 25.36rpx;
				font-size: 21rpx;
				background-color: #FF6034;
				margin-top: 20rpx;
				text-align: center;
				line-height: 61.59rpx;
				color: #fff;
			}
		}

		.xinxi {
			margin-top: 90.57rpx;
			display: flex;
			flex-direction: row;
			justify-content: flex-end;

			.xin-xin {
				background-color: #fcda22;
				border-radius: 39.85rpx 0 39.85rpx 39.85rpx;
				padding: 21.73rpx 32.6rpx;
				font-size: 25.36rpx;
				font-weight: 600;
			}

			.xin-ing {
				width: 79.71rpx;
				height: 79.71rpx;

				image {
					max-width: 100%;
					max-height: 100%;
				}
			}
		}

		.btn-lt {
			position: fixed;
			bottom: 0;
			margin-bottom: 20rpx;
			height: 500rpx;
			background-color: #f7f7f7;
			display: flex;
			flex-direction: column;
			justify-content: flex-start;

			.btn-lt-btn1 {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				margin: 25.36rpx;

				.btn1-left input {
					width: 550.72rpx;
					height: 72.46rpx;
					border-radius: 36.23rpx;
					border: 1.81rpx solid #d9d9d9;
				}

				.btn-lt-btn1-right {
					margin: 7.82rpx 25.36rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;

					.btn-lt-btn1-right-img1 {
						margin: 0 10.86rpx;
						width: 50.72rpx;
						height: 50.72rpx;

						image {
							max-width: 100%;
							max-height: 100%;
						}
					}
				}
			}

			.btn-lt-btn2 {
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				margin-left: 25.36rpx;
				.btn-lt-btn2-left {
					width: 108.69rpx;
					height: 108.69rpx;

					image {
						max-width: 100%;
						max-height: 100%;
					}
				}
			}

		}

		.popup {
			position: fixed;
			left: 0;
			right: 0;
			top: 0;
			background-color: rgba(213, 213, 213, 0.6);
			z-index: 9998;
		}

		.popup-info {
			position: fixed;
			width: 550upx;
			bottom: 0;
			left: 50%;
			transform: translate(-50%, -50%);
			font-size: 30upx;
			padding: 40upx;
			border-radius: 20upx;
			background-color: #fff;
			z-index: 9999;

			span {
				font-size: 28.98rpx;
				text-align: center;
				font-weight: 600;
				margin-left: 40%;
			}

			.popup-input {
				border: 1rpx solid #d8d8d8;
				border-radius: 10rpx;
				height: 120rpx;
				margin-top: 20rpx;

				input {
					font-size: 21rpx;
				}
			}
		}
	}
</style>
